<template>
  <div>
    <!-- 把整体看作一个table -->
    <el-col class="el-col">
      <!-- 头部区域 -->
      <div class="colhead">
        <!-- dataUrls包含formName、placeHolder和url三个属性 -->
        <Web_search_box class="row" v-bind:search-req-url="mySearchUrl" :data-urls="myDataUrls" @SearchResult="mySearch"></Web_search_box>
      </div>
    </el-col>

    <!--Result_form @rowClicked="myClikcEvent" @rowSelected="HandleSelect" v-bind:type-before="myTypeBefore" v-bind:table-head-json-array="myTableHead" v-bind:addition-btns="myAdditionBtns"></Result_form-->
    <Result_form :request-u-r-l="baseUrl" :table-head-json-array="myTableHead" :op-base-url="opBaseUrl" :type-before="myTypeBefore" :addition-btns="myAdditionBtns"></Result_form>


    <El_model v-bind:visible="myModelVisibility" v-bind:form-data="myModelData" v-bind:title="myModelTitle" v-bind:table-head="myTableHead"></El_model>
  </div>
</template>



<script>
  import Web_search_box from "../components/myUtil/Web_search_box";
  import Result_form from "../components/myUtil/Result_form";
  import El_model from "../components/myUtil/El_model";
  export default {
    components: {El_model, Result_form, Web_search_box},
    data() {
      return {
        mySearchUrl:localStorage.getItem('reqBaseUrl') + '/api/course/search',
        myDataUrls:[
          {placeHolder:'所属学校',formName: 'schoolId',url:localStorage.getItem('reqBaseUrl') + '/api/school/search'},
          {placeHolder:'所属学院',formName:'collegeId',url:localStorage.getItem('reqBaseUrl') + '/api/college/search'},
          {placeHolder:'所属专业',formName:'disciplineId',url:localStorage.getItem('reqBaseUrl') + '/api/discipline/search',getName:'professionalTitle'},
        ],
        opBaseUrl:localStorage.getItem('reqBaseUrl') + '/api/course',
        baseUrl:localStorage.getItem('reqBaseUrl') + '/api/course/search?',
        myTypeBefore:[],
        myTableHead: [
          {colName:'id',showName:'id',inModel:false},{colName:'name',showName:'课程名称'},
          {colName: 'discipline',showName: '所属学校',isJson: true,getCol: ['college','school','name'],rename:'schoolName',from:localStorage.getItem('reqBaseUrl') + '/api/school/search'},
          {colName: 'discipline',showName: '所属学院',isJson: true,getCol: ['college','name'],rename:'collegeName',from:localStorage.getItem('reqBaseUrl') + '/api/college/search'},
          {colName: 'discipline',showName: '所属专业',isJson:true,getCol:['professionalTitle'],rename: 'disciplineProfessionalTitle',from:localStorage.getItem('reqBaseUrl') + '/api/discipline/search',getName:'professionalTitle'},
          {colName:'description',showName:'课程描述'},{colName:'classHour',showName:'课时'},{colName:'credit',showName:'学分'},
          {colName: 'isEnabled',showName: '审核状态',inModel:false}],
        myAdditionBtns:[{myStyle:'btn btn-success',name:'审核通过'},{myStyle:'btn btn-warning',name:'查看'},{myStyle:'btn btn-danger',name:'锁定'}],

        mySelections:[],

        myModelVisibility:false,
        myModelTitle:'',
        myModelData:[],

        currentPage: 1,
        pagesize: 10,
      };
    },
    methods: {
      mySearch(url){
        this.baseUrl = url
      }
    }
  };
</script>


<style scoped>
  .colhead {
    padding-bottom: 10px;
    border-bottom: 1px solid #ccc;
  }
</style>
